package com.hmdp.utils;

import com.hmdp.dto.UserDTO;

/**
 * @author 朱振国
 */
public class UserHolder {
    private static final ThreadLocal<UserDTO> THREAD_LOCAL = new ThreadLocal<>();

    public static void saveUser(UserDTO userId) {
        THREAD_LOCAL.set(userId);
    }

    public static UserDTO getUser() {
        return THREAD_LOCAL.get();
    }

    public static void removeUser() {
        THREAD_LOCAL.remove();
    }
}
